package com.zelix;

import java.io.*;
import java.util.HashMap;
import java.util.Vector;
import java.util.zip.*;

public class zx {

    public static final int a;
    private String b;
    private Vector c;
//    private static String z[];

    public zx(ZipFile zipfile, ZipEntry zipentry)
            throws IOException {
        super();
        InputStream inputstream;
        BufferedReader bufferedreader;
        c = new Vector();
        b = zipentry.getName().substring(a);
        inputstream = null;
        bufferedreader = null;
        inputstream = zipfile.getInputStream(zipentry);
        bufferedreader = oc.a(inputstream);
        String s;
        while ((s = bufferedreader.readLine()) != null) {
            int i = s.indexOf("#");
            if (i != -1) {
                if (i > 0) {
                    s = s.substring(0, i - 1);
                } else
                    s = "";
            }
            s = s.trim();
            if (s.length() > 0)
                c.addElement(s);
        }

    }

    public void a(String s, HashMap hashmap) {
        String s1;
        int i;
        s1 = "'META-INF/services/" + b.trim() + "' in '" + s + "'";
        i = 0;
        for (; i < c.size(); i++) {
            String s2 = lt.b((String) c.elementAt(i));
            mt mt = fh.a(s2);
            if (mt != null)
                hashmap.put(mt, s1);
        }
    }

    public void a(ZipOutputStream zipoutputstream, ly ly, boolean flag)
            throws IOException {
        rc rc1;
        PrintWriter printwriter;
        int i;
        String s = b.replace('.', '/');
        String s1 = (String) px.a(s, ly);
        String s2 = s1.replace('/', '.');
        rc1 = new rc(zipoutputstream, "META-INF/services/" + s2, flag);
        printwriter = new PrintWriter(rc1.a());
        i = 0;
        for (; i < c.size(); i++) {
            String s3 = ((String) c.elementAt(i)).replace('.', '/');
            String s4 = (String) px.a(s3, ly);
            printwriter.println(s4.replace('/', '.'));
        }
        printwriter.flush();
        rc1.b();
//        if (gs.b != 0)
//            yx.d = !flag1;
    }

//    private static String z(char ac[]) {
//        for (int i = 0; i < ac.length; i++) {
//            byte key = 0;
//            switch (i % 5) {
//                case 0:
//                    key = 0x22;
//                    break;
//                case 1:
//                    key = 38;
//                    break;
//                case 2:
//                    key = 44;
//                    break;
//                case 3:
//                    key = 54;
//                    break;
//                default:
//                    key = 3;
//                    break;
//            }
//            ac[i] ^= key;
//        }
//        return new String(ac).intern();
//    }

    static {

//        z=new String[]{"'META-INF/services/","' in '","META-INF/services/"};
        a = "META-INF/services/".length();
    }
}
